Skip to content

fix(terminal): package desktop sidecars and embedded native libraries - #2138

Merged
houko merged 3 commits into
mainfrom
fix/terminal-package-libraries-1454
Nov 22, 2026
Merged

houko merged 3 commits into
mainfrom
fix/terminal-package-libraries-1454

Conversation

@houko

@houko houko commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Apps importing base/terminal now ship libghostty-vt beside Windows/Linux executables, in arm64 AARs, and as a companion GhosttyVT.xcframework beside static or dynamic embedded iOS frameworks. The companion includes device arm64, simulator arm64/x86_64 and Catalyst arm64/x86_64; hosts embed and sign it. Catalyst library discovery follows the host’s Contents/Frameworks layout.

The generator adds the missing Apple prebuilds and a selective -target rebuild flag. Public English/Chinese docs, the agent skill and the terminal roadmap describe host setup and remaining gaps.

Refs #1454. Keep the issue open for the Android prerequisite and real Android embedding-host acceptance.

Verification

  • go tool nsgo check -target macos,ios,windows,linux,android,web,tvos,watchos -jobs 4: all selected target architectures passed.
  • Focused packaging, bundle discovery, generator selection, Apple minimum, layering, skills, duplicate-change and changelog tests passed.
  • Real Linux and Windows packages executed with isolated empty caches: public Terminal.New/Feed/Text consumed ANSI output, LibraryPath selected the packaged sidecar, and no embedded fallback was extracted. Windows ran on a host without Go.
  • Built complete static and dynamic iOS XCFramework packages. The opt-in companion test verified all five architecture slices, framework signatures and omission for apps without the terminal.
  • The existing Swift embedding host, unchanged, rendered two terminal views in an owned iOS 27 simulator for both static and dynamic app frameworks. Logs showed Host.app/Frameworks/GhosttyVT.framework/GhosttyVT; screenshots were inspected. The unchanged host also ran on Mac Catalyst and loaded Host.app/Contents/Frameworks/GhosttyVT.framework/GhosttyVT.
  • Real arm64 AAR builds included byte-identical jni/arm64-v8a/libghostty-vt.so for terminal apps and omitted it otherwise.

Prerequisites and limits

The native Apple host runs used only the safe-area registration hunks from unmerged #2119 in an isolated verification copy: baseline main otherwise panics before terminal startup because NsgoSurface registers safeAreaInsetsDidChange twice. This PR does not duplicate that fix. Static/dynamic artifact builds and companion tests pass without the overlay.

The AAR test used the verification-only Android arm64 prebuild from #2139 (Android support for #1452), head 055e6fcb90d231fc29c541029b512af075c8b83f, SHA-256 e4ffd6c8c2fdab2998931025e427e134c95871f5b51a9f76540eba4cee4d4d5f. Neither that Android binary nor its loader is duplicated here. #2139 must merge before a terminal AAR is usable. This test proves the AAR payload, not Android runtime/device acceptance. Android x86_64 has no terminal prebuild. Physical iOS hosts and Intel execution were not exercised; their framework slices were built and inspected.

@github-actions github-actions Bot added bug Something isn't working size/L documentation Improvements or additions to documentation base cli and removed bug Something isn't working size/L labels Nov 22, 2026
@github-actions github-actions Bot added bug Something isn't working size/L labels Nov 22, 2026
@houko
houko force-pushed the fix/terminal-package-libraries-1454 branch from af4d299 to 1b53a75 Compare November 22, 2026 23:56
@houko

houko commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed. Checked that every packaging path asks go list -deps whether the app links base/terminal/internal/library for that exact target, that desktop sidecars are validated against the target before copying, that the companion XCFramework is rebuilt (or removed) on each embed build and has no app headers, and that Catalyst discovery looks in Contents/Frameworks.

One fix pushed: the repository has no lib/android-* prebuild yet (#1452), so androidGhosttyFile failed every -embed AAR build of an app that links the terminal with "read Android libghostty-vt". A missing prebuild now leaves the AAR without it, as before this PR (APKs already behave that way); a present one is still packed into jni/<abi>/. Also rebased (roadmap conflict) and unwrapped the comment paragraphs touched. vet and the library, tool and cmd/nsgo packaging tests pass on Linux; the opt-in native package tests were not rerun.

@houko
houko merged commit 51fb710 into main Nov 22, 2026
@houko
houko deleted the fix/terminal-package-libraries-1454 branch November 22, 2026 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

base bug Something isn't working cli documentation Improvements or additions to documentation size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant